using System;
using System.Runtime.Serialization;
using MiniStock.Entities.Common;
using MiniStock.Entities.Stock.Events.Product;

namespace MiniStock.Entities.Stock.Events.Order
{
    [DataContract]
    public class SetOrderShippedEvent : OrderEventBase
    {
        [DataMember]
        public DateTime? ShippedDate { get; set; }

        public override void ValidateFor(EntityBase entity, IEntityProvider provider)
        {
            base.ValidateFor(entity, provider);
            // TODO: Validate
        }

        public override void ApplyTo(EntityBase entity)
        {
            var item = (Stock.Order) entity;
            item.OrderShipped = this.ShippedDate;
        }
    }
}